package com.hdc.xposeddemo.xposed;

import de.robv.android.xposed.IXposedHookLoadPackage;
import de.robv.android.xposed.XC_MethodReplacement;
import de.robv.android.xposed.XposedHelpers;
import de.robv.android.xposed.callbacks.XC_LoadPackage;

public class XposedHookUtil implements IXposedHookLoadPackage {
    public static final String class_name = "com.hdc.xposeddemo.MainActivity";
    @Override
    public void handleLoadPackage(XC_LoadPackage.LoadPackageParam loadPackageParam) throws Throwable {

        Class clazz = loadPackageParam.classLoader.loadClass(class_name);
        XposedHelpers.findAndHookMethod(clazz, "getTTAd", new XC_MethodReplacement() {
            @Override
            protected Object replaceHookedMethod(MethodHookParam methodHookParam) throws Throwable {
                return "广告被拦截了";
            }
        });

        HookAppAllMethod.hookMethod(loadPackageParam);


    }

}
